<template>
  <div>
    <h1>欢迎回来, {{ username }}!</h1>
    <p>这是您的主页。</p>
    <button @click="logout">注销</button>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();
const username = ref('admin'); // 假设用户登录时用户名为 'admin'

const logout = () => {
  // 注销逻辑
  router.replace({ name: 'LoginPage' }); // 假设存在登录页面
};
</script>

<style scoped>
h1 {
  color: #2c3e50;
}
</style>
